#include "menulist.h"
#include "ui_menulist.h"
#include"widget.h"
#include"sitting.hpp"
#include<QAction>
menulist::menulist(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::menulist)
{
    ui->setupUi(this);
    x= y=0;
}

void menulist::init(clihnum & clsts,Getinftonet *getins,bool a){
    clst=clsts;
    getin=getins;

    ui->ischick->setText("状态："+clsts.ischick);
    ui->time->setText("时间："+clsts.time);
    ui->mony->setText("金额："+clsts.mony);

    for(int i=0;i<clsts.menus.count();i++){
        QListWidgetItem *add_item = new QListWidgetItem(QIcon(":/images/heart00.png"),clsts.menus[i].name+" "+clsts.menus[i].money);
        ui->listWidget->addItem(add_item);
    }
    if(a){
        ui->pushButton->hide();
        ui->pushButton_2->hide();
    }

}


menulist::~menulist()
{
    delete ui;
}



void menulist::on_pushButton_clicked()
{
   emit sigmlistdel(clst);
QByteArray buf;
buf.append(QString("{\"id\":\"%1\"}").arg(clst.id));

    getin->topost(QString(urls.c_str())+"/cliokmenu",buf);


    delete this;
}
